<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>助管信息录入系统</title>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
    <link href="css/login.css" rel="stylesheet">
</head>

<body>
    <nav class="navbar navbar-default navbar-static-top nav-header" role="navigation">
        <div class="container">
            <div>
                <div class="navbar-left">
                    <a href="./index.html">助管信息录入系统</a>
                </div>
            </div>
        </div>
    </nav>
    <div class="container content" id='login-container' v-cloak>
        <div class="backimg"> <img src="./images/background.jpg"></div>
        <div class="actions-panel login-panel mt-100">
            <div class="container">
                <div class="panel panel-primary">
                    <header class="cnt-mid-head">用户信息登录</header>
                    <div id="myForm" class="form-horizontal mt-20" role="form" action="http://115.29.136.190:8080/help/usr/user/shiroLogin.do" method="post">
                        <div class="form-group">
                            <label for="role" class="col-sm-2 control-label">角色</label>
                            <div class="col-sm-8" style="text-align: left;">
                                <select id="role" class="form-control form-select" name="role">
                                    <option value="0">管理员</option>
                                    <option value="1">老师</option>
                                    <!-- <option value="2">学生</option> -->
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputEmail3" class="col-sm-2 control-label">用户名</label>
                            <div class="col-sm-8">
                                <input id="LoginName" class="form-control" name="loginName">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputPassword3" class="col-sm-2 control-label">密码</label>
                            <div class="col-sm-8">
                                <input id="pwd" type="password" class="form-control" name="password">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" onclick="doLogin()" class="btn btn-default">登录</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <footer class="navbar navbar-default navbar-footer mt-20">
        <div style="clear:both"></div>
        <div class="container">
            <div class="row">
                <div class="col-xs-8" style="margin-top:10px;">
                    <div>
                        <p>
                            清水河校区: 成都市高新区（西区）西源大道2006号 &nbsp; 邮编:&nbsp;611731 &nbsp;&nbsp;</p>
                        <p>
                            沙河校区: 成都市建设北路二段四号 &nbsp; 邮编:&nbsp;610054</p>
                        <p>
                            蜀ICP备&nbsp;05006379&nbsp;号&nbsp;&nbsp;&nbsp;I　川公网安备&nbsp;51019002000280&nbsp;号&nbsp;</p>
                    </div>
                </div>
            </div>
        </div>
    </footer>
</body>
<script type="text/javascript" src="./js/common/url.js"></script>
<script type="text/javascript" src="jsnew/dist/jquery-2.2.4.js"></script>
<script type="text/javascript" src="jsnew/dist/bootstrap.min.js"></script>
<script type="text/javascript" src="jsnew/dist/vue.js"></script>
<script src="jsnew/dist/base64.js"></script>
<script src="jsnew/dist/md5.min.js"></script>
<!-- <script src="jsnew/login.js""></script> -->
<script>
/*检测浏览器*/
if (window.localStorage) {
    // checkUser();
    // alert('This browser supports localStorage');
} else {
    alert('该浏览器版本较低，为了更好的使用，请更换浏览器再试！');
}

function doLogin() {
    var user = {
        "LoginName": $('#LoginName').val(),
        "pwd": btoa(md5($('#pwd').val())),
        // "role": $('#role').val()
        "role": $('#role').val()
    }
    $.ajax({
        type: "POST",
        url: baseUrl + 'usr/user/shiroLogin.do' + "?loginName=" + user.LoginName + "&password=" + user.pwd + "&role=" + user.role,
        contentType: "application/json; charset=utf-8",
        dataType: 'json',
        xhrFields: {
            withCredentials: true
        },
        crossDomain: true,
        success: function(result) {
            if (result.status == 1) {
                // alert(result.message);
                // console.log(result.message);
                // $('#login').window('close');
                // console.log("");
                window.location.href = './index.html';
                //用户登录后检查登录状态
                // init();
            } else {
                 alert(result.message);
                console.log(result.message);
            }

        }
    });
}
</script>

</html>
